const http = require('http')

const server = http.createServer((req, res) => {
  const url = 'https://bing.com'
  const body = `<p>Redirecting to <a href="${url}">${url}</a></p>`
  res.setHeader('Location', url)
  res.setHeader('Content-Length', Buffer.byteLength(body))
  res.setHeader('Content-Type', 'text/html')
  res.statusCode = 302
  res.end(body)
})
server.listen(3000, () => {
  console.log('HTTP server running in port: http://localhost:3000')
})
